project(UnitTest)
set(CXX_FLAGS
    -g
    -Wall
    -Wno-unused-function

)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")

MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM_NAME}")

if(${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
    string(APPEND CMAKE_CXX_FLAGS " -std=gnu++11 -D_GNU_SOURCE=1 ")
else()
    string(APPEND CMAKE_CXX_FLAGS " -std=c++14 ")
    MESSAGE(STATUS "add std c++14")
endif()
MESSAGE(STATUS "CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}")

set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

SET(CMAKE_USE_RELATIVE_PATHS "ON")
SET(CMAKE_CXX_COMPILER "g++")
SET(CMKAE_C_COMPILER "gcc")
SET(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_platform/shared/inc)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_platform/user_if/inc)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_platform/foundation/inc)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_platform/cfg_mgr/inc)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_platform/msg_list/inc)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_log/include)
include_directories(${PROJECT_SOURCE_DIR}/../xncc_tools/include)

include_directories(./inc)

# 查找当前目录下的所有源文件
# 并将名称保存到 DIR_SRCS 变量
aux_source_directory(./src SRC_LIST)
# aux_source_directory(${PROJECT_SOURCE_DIR}/../xncc_platform/shared/src SRC_LIST)
# aux_source_directory(${PROJECT_SOURCE_DIR}/../xncc_platform/user_if/src SRC_LIST)
# aux_source_directory(${PROJECT_SOURCE_DIR}/../xncc_platform/foundation/src SRC_LIST)
# aux_source_directory(${PROJECT_SOURCE_DIR}/../xncc_platform/cfg_mgr/src SRC_LIST)
# aux_source_directory(${PROJECT_SOURCE_DIR}/../xncc_platform/msg_list/src SRC_LIST)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
link_directories(../xncc_log/lib)
link_directories(../lib)

add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME}
    pthread
    gtest
    xncc_log
    xncc_platform
)
